﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;

namespace wms.Common
{
    class PrintDocumentPaginator : DocumentPaginator
    {
        private int _pageCount = 0;
        private Size _pageSize = new Size(500, 500);
        private List<Visual> _visuals;

        public PrintDocumentPaginator(List<Visual> visuals) {
            this._pageCount = visuals.Count;
            _visuals = visuals;
        }

        public override bool IsPageCountValid
        {
            get
            {
                return true;
            }
        }

        public override int PageCount
        {
            get
            {
                return _pageCount;
            }
        }

        public override Size PageSize
        {
            get
            {
                return _pageSize;
            }
            set
            {
                _pageSize = value;
            }
        }

        public override IDocumentPaginatorSource Source
        {
            get
            {
                return null;
            }
        }

        public override DocumentPage GetPage(int pageNumber)
        {
            return new DocumentPage(_visuals[pageNumber], _pageSize, new Rect(_pageSize), new Rect(_pageSize));
        }
    }
}
